<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>Document</title>
    <style>
        canvas{
            border: solid 1px black;
            margin: 0 auto;
            display: block;
        }
    </style>
</head>

<body>
    <canvas id="myCanvas" width="500px" height="500px">
        
    </canvas>
    <script>
        var myCanvas = document.getElementById('myCanvas');
        var paint = myCanvas.getContext('2d');
  
        paint.beginPath(); 
        paint.lineWidth = 10;
        paint.strokeStyle = 'red';     
        paint.moveTo(20,20); 
        paint.lineTo(200,20);
        paint.stroke();

        paint.beginPath();
        paint.lineWidth = 10;
        paint.lineCap = 'square'
        paint.moveTo(20,40);
        paint.lineTo(200,40);
        paint.strokeStyle = 'yellow';
        paint.stroke();

      
        paint.beginPath();
        paint.lineWidth = 10;
        paint.lineJoin = 'round';
        paint.moveTo(20,60);
        paint.lineTo(200,60);
        paint.lineTo(100,120);
        paint.closePath();

        paint.fillStyle = 'pink';
        paint.fill();
        

        
       
    </script>

</body>

</html>